package com.xingkeduo.business.schedule.service.userhandler;

import com.xingkeduo.business.schedule.remote.ConsumerRemoteService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author:gaozifeng
 * @Date 2019/6/5 15:45
 **/
@JobHandler(value = "userJobHandle")
@Component
public class UserJobHandle extends IJobHandler {


    @Resource
    private ConsumerRemoteService consumerRemoteService;

    @Override
    public ReturnT<String> execute(String param) {
        XxlJobLogger.log("XXL-JOB, user定时任务.剪发提醒,扫描");
        try {
            consumerRemoteService.pushUserCutHair();
            XxlJobLogger.log("扫描成功");
        } catch (Exception e) {
            XxlJobLogger.log("扫描失败,msg[{}]", e.getMessage());
            XxlJobLogger.log(e.getMessage());
        }
        return SUCCESS;
    }

}
